package qita.somme5chiffres.sol2;

import java.util.List;


/**
 * 1--500中任取5个不同的数字，使得5数之和恰为5的倍数，有多少种方案
 * @author libojuve@gmail.com
 *
 */
public class Solution2 {

	public static void main(String[] args) {
//		int[] modulo = new int[5 * 5];

//		for (int i = 0; i < 5; ++i) {
//			for (int j = 0; j < 5; ++j) {
//				modulo[i*5 + j] = i;
//			}
//		}
		int[] rest = new int[5];
		for (int i = 0; i < 5; ++i) {
			rest[i] = i;
		}


		for (int a = 0; a < 5; ++a) {
			for (int b = a; b < 5; ++b) {
				for (int c = b; c < 5; ++c) {
					for (int d = c; d < 5; ++d) {
						for (int e = d; e < 5; ++ e) {
							if ((rest[a] + rest[b] + rest[c] + rest[d] + rest[e]) % 5 == 0) {
								System.out.println(rest[a] + ", " + rest[b] + ", " + rest[c] + ", " + rest[d] +
										", " + rest[e]);
							}
						}
					}
				}
			}
		} // fin de for a


	}

	public static int getNbCombinaison(List<Integer> aList) {
		return 0;
	}

	public static int getNbSameRest(int from, int to, int rest) {
		rest = rest % 5;
		return 0;
	}
}
